

package map.android.baidu.carpool;

import android.util.SparseArray;
import map.android.baidu.carpool.data.CarpoolRequestParam;
import map.android.baidu.carpool.utils.UniversalSourceFromParameter;

/**
 * Network config
 */
public class WebConfig {
    //定义网络请求地址 请求接口
    public static final String SERVER_DOMAIN_ONLINE = "http://carpo.baidu.com/";
    public static final String WEBVIEW_DOMAIN_ONLINE = "http://carpo.baidu.com/";
//   public static final String SERVER_DOMAIN_ONLINE = "http://cp01-rdqa-pool406.cp01.baidu.com:8088";
    //public static final String SERVER_DOMAIN_ONLINE = "http://nj03-canary-app0004.nj03.baidu.com:8000";
    //    public static final String SERVER_DOMAIN_ONLINE = "http://180.149.144.163:8088";
    // public static final String SERVER_DOMAIN_ONLINE = "http://cq01-rdqa-dev090.cq01.baidu.com:8060/";
    //public static final String SERVER_DOMAIN_ONLINE = "http://cp01-rdqa-dev415.cp01.baidu.com:8889/";

    public static final String STATISTICS_DOMAIN = "http://client.map.baidu.com/place/v5/img/transparent_gif";

    /**
     * 基础配置信息接口
     */
    public static final int URL_ID_CONFIG = 99;
    /**
     * 基础信息接口
     */
    public static final int URL_ID_BASE_INFO = 100;
    /**
     * 计费信息接口
     */
    public static final int URL_ID_ACCOUNT = 101;

    /**
     * 已通知的车主数量接口
     */
    public static final int URL_ID_NOTICE_COVER = 102;
    /**
     * 取消订单接口
     */
    public static final int URL_ID_ORDER_CANCEL = 103;
    /**
     * 优惠券列表接口
     */
    public static final int URL_ID_DISCOUNT_LIST = 104;
    /**
     * 添加优惠券接口
     */
    public static final int URL_ID_DISCOUNT_ADD = 105;
    /**
     * 获取订单列表接口
     */
    public static final int URL_ID_ORDER_LIST = 106;
    /**
     * 获取订单详情接口
     */
    public static final int URL_ID_ORDER_DETAIL = 107;
    /**
     * 确认搭乘接口
     */
    public static final int URL_ID_ORDER_FINISH = 108;
    /**
     * 用户发布路线创建订单接口
     */
    public static final int URL_ID_ORDER_CREATE = 109;

    /**
     * lbspay支付获取支付接口
     */
    public static final int URL_ID_GET_PAY = 110;

    /**
     * 评价车主接口
     */
    public static final int URL_ID_USER_CREATE_COMMENT = 111;
    /**
     * 获取我的评价列表
     */
    public static final int URL_ID_USER_COMMENT_LIST = 112;
    /**
     * 获取车主评价列表
     */
    public static final int URL_ID_USER_DRIVER_COMMENT_LIST = 113;
    /**
     * 个人中心接口
     */
    public static final int URL_ID_USER_CENTER = 114;
    /**
     * 修改个人资料接口，不包含照片
     */
    public static final int URL_ID_MODIFIER_USER_INFO = 115;
    /**
     * 上传头像照片接口
     */
    public static final int URL_ID_MODIFIER_HEAD_PIC = 116;

    /**
     * 入口展示的数据接口
     */
    public static final int URL_ID_MAIN_INFO = 117;

    /**
     * 发大礼包活动接口
     */
    public static final int URL_ID_DA_LI_BAO = 118;
    private static final SparseArray<String> sUrlArray = new SparseArray<String>();

    static {
        sUrlArray.put(URL_ID_CONFIG, "/main/config?");
        sUrlArray.put(URL_ID_BASE_INFO, "/main/baseinfo?");
        sUrlArray.put(URL_ID_ACCOUNT, "/main/account?");
        sUrlArray.put(URL_ID_NOTICE_COVER, "/main/noticecover?");
        sUrlArray.put(URL_ID_ORDER_CANCEL, "/main/order/cancel?");
        sUrlArray.put(URL_ID_DISCOUNT_LIST, "/main/discount/discountlist?");
        sUrlArray.put(URL_ID_DISCOUNT_ADD, "/main/discountadd?");
        sUrlArray.put(URL_ID_ORDER_LIST, "/main/order/list?");
        sUrlArray.put(URL_ID_ORDER_DETAIL, "/main/order/detail?");
        sUrlArray.put(URL_ID_ORDER_FINISH, "/main/order/finish?");
        sUrlArray.put(URL_ID_ORDER_CREATE, "/main/order/create?");

        sUrlArray.put(URL_ID_GET_PAY, "/pay/getpay?");

        sUrlArray.put(URL_ID_USER_CREATE_COMMENT, "/user/comment/create?");
        sUrlArray.put(URL_ID_USER_COMMENT_LIST, "/user/comment/list?");
        sUrlArray.put(URL_ID_USER_DRIVER_COMMENT_LIST, "/user/comment/driverlist?");
        sUrlArray.put(URL_ID_USER_CENTER, "/user/center?");
        sUrlArray.put(URL_ID_MODIFIER_USER_INFO, "/user/modinfo?");
        sUrlArray.put(URL_ID_MODIFIER_HEAD_PIC, "/user/modpic?");

        sUrlArray.put(URL_ID_MAIN_INFO, "/main/info?");
        sUrlArray.put(URL_ID_DA_LI_BAO, "/main/discount/applyactivity?");
    }

    public static String getUrl(int id) {
        return SERVER_DOMAIN_ONLINE + sUrlArray.get(id) +
                UniversalSourceFromParameter.getInstance().getStatisticKeyValues() + CarpoolRequestParam
                .noNeedPostParams();
    }

    public static String getStatisticsUrl(){
        return STATISTICS_DOMAIN + CarpoolRequestParam.noNeedPostParams();
    }

    public static String getWebViewUrl(int id) {
        return WEBVIEW_DOMAIN_ONLINE + sUrlArray.get(id);
    }

    public static String getWebViewUrlBillingDescription(int id) {
        return WEBVIEW_DOMAIN_ONLINE + sUrlArray.get(id);
    }

}
